package d6_singleInstance;

public class B {
    private static B b;//2.定义一个类变量用于存储这个类的对象
    private B(){ //1.类构造器私有
    }
    public static B getInstance(){
        if(b==null){
            b=new B();
        }
        return b;
    }
}
